﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace TestConsole
{
    public class test_yield
    {
        string[] strDays = {"Sum", "Mon","Tue" };

        public IEnumerator GetEnumerator()
        {
            foreach (var item in strDays)
            {
                yield return strDays;
            }
        }

        public IEnumerable  GetOtherEnumerator()
        {
            foreach (var item in strDays)
            {
                yield return strDays;
            }
        }
    }

    public class test_Program   {

        public void  test()
        {
            test_yield t = new test_yield();

            foreach (var item in t)
            {
                Console.WriteLine(item);
            }

            IEnumerable itest = t.GetOtherEnumerator();
            foreach (var item in itest )
            {
                Console.WriteLine(item);
            }

        }
    }
}
